import os

from flask import Flask

app = Flask(__name__, template_folder='template', static_url_path='/', static_folder='resource')

# 启用session
app.config["SECRET_KEY"] = os.urandom(24)  # 生成随机数种子，用于生成sessionId

from controller.index import index

app.register_blueprint(index)

from controller.index2 import index2

app.register_blueprint(index2)

from controller.index3 import index3

app.register_blueprint(index3)

from controller.index4 import index4

app.register_blueprint(index4)

from controller.index5 import index5

app.register_blueprint(index5)

from controller.index6 import index6

app.register_blueprint(index6)

from controller.index7 import index7

app.register_blueprint(index7)

# 自定义过滤器
@app.template_filter('add')
def add(i):
    return i + 1


# jinja2全局函数
def add2(a, b):
    return a + b


app.jinja_env.globals.update(myadd=add2)

if __name__ == '__main__':
    app.run()
